package com.huidu.bitrade.controller;

import com.huidu.bitrade.dto.AcGroupChargeQuery;
import com.huidu.bitrade.dto.AcMemberChargeQuery;
import com.huidu.bitrade.pagination.PageResult;
import com.huidu.bitrade.result.page.PageCondition;
import com.huidu.bitrade.task.HdzOrderTask;
import com.huidu.bitrade.vo.AcChargeAwardRecordVo;
import com.huidu.bitrade.service.AcGroupChargeAwardService;
import com.huidu.bitrade.service.AcMemberService;
import com.huidu.bitrade.util.MessageResult;
import com.huidu.bitrade.vo.AcGroupChargeAwardVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "新增奖励模块/手续费奖励")
@RestController
@AllArgsConstructor
@Slf4j
public class HandlingFeeController {

    private final AcMemberService acMemberService;
    private final AcGroupChargeAwardService acGroupChargeAwardService;
    private final HdzOrderTask hdzOrderTask;

    /**
     * 发放交易手续费奖励（hdc）
     */
    @ApiOperation(value = "发放交易手续费奖励（hdc）")
    @GetMapping("chargeHdcAward")
    public MessageResult chargeHdcAward(){
        acMemberService.chargeHdcAward();
        return MessageResult.success();
    }

    /**
     * 推荐手续费奖励发放
     */
    @ApiOperation(value = "发放团队交易手续费")
    @GetMapping("chargeAwardGrant")
    @ApiImplicitParam(name = "dateStr",value = "发放指定日期的团队手续费奖励")
    public MessageResult chargeAwardGrant(@RequestParam(required = false) String dateStr){
        acMemberService.chargeAwardGrant(dateStr);
        return MessageResult.success();
    }

    /**
     * hdz质押挖矿奖励发放
     */
    @ApiOperation(value = "hdz质押挖矿奖励发放")
    @GetMapping("createDetail")
    public MessageResult createDetail(){
        hdzOrderTask.createDetail();
        return MessageResult.success();
    }

    /**
     * 查询用户交易手续费
     */
    @ApiOperation(value = "查询用户交易手续费")
    @GetMapping("getChargeAwardRecord")
    public PageResult<AcChargeAwardRecordVo> getChargeAwardRecord(AcMemberChargeQuery acMemberQuery){
        return new PageResult<>(acGroupChargeAwardService.getChargeAwardRecord(PageCondition.page(acMemberQuery),acMemberQuery));
    }

    /**
     * 查询团队推荐手续费奖励
     */
    @ApiOperation(value = "查询团队推荐手续费奖励")
    @GetMapping("getGroupChargeAward")
    public PageResult<AcGroupChargeAwardVo> getGroupChargeAward(AcGroupChargeQuery acMemberQuery){
        return new PageResult<>(acGroupChargeAwardService.getGroupChargeAward(PageCondition.page(acMemberQuery),acMemberQuery));
    }


}
